package edu.chl.grupp11.aegas.model;

import java.util.Observable;

public abstract class AbstractMetaTag extends Observable implements
		Comparable<AbstractMetaTag> {

	private String name;
	private String value;

	public AbstractMetaTag(String name, String value) {
		this.name = name;
		this.value = value;
	}

	/**
	 * @return 0 if the objects are equal and 1 if they are not equal.
	 */
	@Override
	public int compareTo(AbstractMetaTag tag) {
		if (!(this.getName().equalsIgnoreCase(tag.getName()) && this.getValue()
				.equalsIgnoreCase(tag.getValue()))) {
			return 1;
		}
		return 0;
	}

	public String getName() {
		return name;
	}

	public String getValue() {
		return value;
	}

	public void setName(String n) {
		name = n;
		setChanged();
		notifyObservers();
	}

	public void setValue(String v) {
		value = v;
		setChanged();
		notifyObservers();
	}

	@Override
	public String toString() {
		return "Name: " + name + " Value:" + value;
	}

}
